#include "RefractStage.h"
#include "SceneNode.h"

namespace egg{

    RefractStage::RefractStage(){
        mQuad=gGeometryLib.getGeometry("quad");
        mShader=gShaderLib.getShader("refract");
        mParamMap.bindShader(mShader);
        int test=glGetUniformLocation(mShader->getID(),"uni_vec4_frustum");
        mParamMap.bindNumericParam("uni_vec4_frustum");
        mParamMap.bindTextureParam("uni_sampler2D_gExt");
        mParamMap.bindTextureParam("uni_sampler2D_gNormal");
        mParamMap.bindTextureParam("uni_sampler2D_gPosition");
        mColor=mParamMap.getTextureParam("uni_sampler2D_color");
    }

    void RefractStage::doRender(const FrameEvent& evt,TexturePtr color){
        mColor->mTexture=color;
        mParamMap._commitParamsForce();
        mQuad->draw();
    }

}